import React, { Component } from 'react';
import './AppItem.css';
import RetinaImage from 'react-retina-image';

class AppItem extends Component {

    constructor(props) {
        super(props);
        this.handleClick = this.handleClick.bind(this);
    }

    render() {
        const { appicon, appname } = this.props;
        return (
            <div className='AppItemBackground'>
                <a href="javascript:void(0)" onClick={this.handleClick}>
                    <div>
                        <RetinaImage className='AppIcon' src={appicon} checkIfRetinaImgExists={true} />
                        <span className='AppName'>{appname}</span>
                    </div>
                    <div className='Line'></div>
                </a>

            </div>
        );
    }

    handleClick() {
        window.open(this.props.downloadurl);
    }

}

export default AppItem;
